

with open("D:\\桌面\\1.txt", 'r' , encoding='utf8') as f :
    # 代码块
    # 代码块
    #......